/*
	创建于2016/08/08
	作者：He Yujie，JLHS
*/

#include "Arduino.h"
#include "Servo.h"
#include "JY901.h"
#include "JY901_dfs.h"

#ifndef _JLROBOT_H_
#define _JLROBOT_H_

struct JlMotor
{
  uint8_t pinA;
  uint8_t pinB;
  uint8_t pinPwm;
};

class JlRobot
{
public:
  JlMotor *leftMotor;
  JlMotor *rightMotor;  
  HardwareSerial *gyroSerial;
  HardwareSerial *servoSerial;

  void initGyroSerial(HardwareSerial *serial);

  void resetGyro();

  void initMotor(JlMotor *lMotor, JlMotor *rMotor);

  void initExtServo(HardwareSerial *serial);

  void setMotor(JlMotor &motor, int speed); 

  void run(int lSpeed, int rSpeed);

  void setExtServo(char channel, int angle, int speed);

  void actExtServo(int number);

  bool setServo(Servo &servo, unsigned int angle);

  bool setServo(Servo &servo, int angle, int speed);
};


#endif
